package com.senken.service.impl;

import org.springframework.stereotype.Service;

import com.senken.mapper.TotalstateMapper;
import com.senken.entity.Totalstate;
import com.senken.service.ITotalstateService;
import com.baomidou.framework.service.impl.SuperServiceImpl;

/**
 *
 * Totalstate 表数据服务层接口实现类
 *
 */
@Service
public class TotalstateServiceImpl extends SuperServiceImpl<TotalstateMapper, Totalstate> implements ITotalstateService {


	@Override
	public int counts(int fid,int state){
		Totalstate totalstate = new Totalstate();
		totalstate.setFid(fid);
		totalstate.setState(state);
		return selectCount(totalstate);
	}
	
	@Override
	public boolean add(int Hid,int fid){
		Totalstate totalstate = new Totalstate();
		totalstate.setFid(fid);
		totalstate.setHid(Hid);
		totalstate.setState(0);
		return this.insert(totalstate);
	}
	
	@Override
	public boolean updatestate(int Hid,int fid,int state){
		Totalstate totalstate = new Totalstate();
		totalstate.setHid(Hid);
		totalstate.setFid(fid);
		totalstate = this.selectOne(totalstate);
		totalstate.setState(state);
		return this.updateById(totalstate);
	}
}